home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_09_08 / 9n08014a < prev    next >
Text File  |  1991-07-08  |  458b  |  18 lines

  1. /* modf function */
  2. #include "xmath.h"
  3.  
  4. double (modf)(double x, double *pint)
  5.         {       /* compute modf(x, &intpart) */
  6.         *pint = x;
  7.         switch (_Dint(pint, 0))
  8.                 {       /* test for special codes */
  9.         case NAN:
  10.                 return (x);
  11.         case INF:
  12.         case 0:
  13.                 return (0.0);
  14.         default:        /* finite */
  15.                 return (x - *pint);
  16.                 }
  17.         }
  18.